
#include "InitObject.h"

#include "WorkThreadManager.h"

#include "NetworkManager.h"

#include "mainwindow.h"
#include "mainImg.h"

InitObject *InitObject::s_Instance = Q_NULLPTR;

InitObject::~InitObject()
{
    delete WorkThreadManager::Instance();

	delete NetworkManager::Instance();

    s_Instance = Q_NULLPTR;
}

void InitObject::connectDepthDataProcess(MainWindow *procObj)
{
	connect(NetworkManager::Instance(), &NetworkManager::receiveDepthFrame,
			procObj, &MainWindow::onReceiveDepthFrame);
}

void InitObject::connectDepthDataProcess(MainImg *procObj)
{
	connect(NetworkManager::Instance(), &NetworkManager::receiveDepthFrame,
			procObj, &MainImg::onReceiveDepthFrame);
}

void InitObject::startInit(void)
{
    emit initStart();

    /* 界面启动后的初始化 */
    WorkThreadManager::Instance()->init();

	NetworkManager::Instance()->init();

    emit initFinish();
}

InitObject::InitObject(QObject *parent) :
    QObject(parent)
{
    /* 构造函数只对优先于界面的初始化的类进行 */
    WorkThreadManager::Instance();

	NetworkManager::Instance();
}

